<?php

namespace app\admin\validate;

use think\Validate;

class Behavior extends Validate
{

    /**
     * 正则
     */
    protected $regex = ['format' => '[a-z0-9_\/]+'];

    /**
     * 验证规则
     */
    protected $rule = [
        'name'  => 'require',
        'type'  => 'require',
        'score' => 'require|positiveInt',
    ];

    /**
     * 提示消息
     */
    protected $message = [
        'score.positiveInt' => '分值 必须为正整数'
    ];

    /**
     * 字段描述
     */
    protected $field = [
    ];

    /**
     * 验证场景
     */
    protected $scene = [
    ];

    protected function positiveInt($value, $rule='', $data)
    {
        if (is_int(($value+0))&&($value+0)>0) {
            return true;
        }else{
            return false;
        }
    }


}
